
@namespaces: vt;

.@{namespaces}-message-package{
    width: 100%;
    height: 0;
    position: fixed;
    display: flex;
    flex-direction: column;
    z-index: 20000;
    padding: 0 15px;
    top: 0;
    font-size: 1rem;
    box-sizing: border-box;
    text-align: center;
    &.@{namespaces}-message-mask{
        height: 100%;
        background-color: rgba(0,0,0,0.2);
    }

    *{
        box-sizing: border-box;
    }
}
.@{namespaces}-message{
    opacity: 1;
    position: relative;
    animation-duration: 0.5s;
    animation-fill-mode: forwards;
    border: 1px solid #dcdee2;
    background-color: #fff;
    border-radius: 5px;
    min-width: 240px;
    max-width: 520px;
    box-sizing: border-box;
    *{
        box-sizing: border-box;
    }


    .@{namespaces}-message-header{
        display: flex;
        font-size: 1rem;
        padding: 10px 16px;
        border-bottom: 1px solid #eee;
    }
    // close
    .@{namespaces}-hide{
        color: #ccc;
        font-weight: 300;
        margin-right: 0;
        margin-left: auto;
        width: 25px;
        cursor: pointer !important;

        &:hover{
            color: #aaa;
        }
    }

    .@{namespaces}-message-body{
        flex-wrap: wrap;
        letter-spacing: 1px;
        text-decoration: none;
        width: 100%;
        padding: 7px 16px;
        text-align: left;

        .@{namespaces}-hide{
            position: absolute;
            right: 0;
            top: 5px;
        }
    }

    .@{namespaces}-message-footer {
        padding: 14px 16px;
        margin-top: 5px;
        border-top: 1px solid #eee;
        text-align: right;

        button{
            line-height: 1;
            display: inline-block;
            font-weight: 400;
            text-align: center;
            vertical-align: middle;
            cursor: pointer;
            outline: none;
            white-space: nowrap;
            user-select: none;
            height: 30px;
            padding: 0 15px;
            font-size: 14px;
            border-radius: 4px;
            margin-bottom: 0;

            &:after {
                display: none;
                transition: color ease 0.3s;
            }
            &.@{namespaces}-confirm{
                margin-left: 8px;
                color: #fff;
                background-color: #2d8cf0;
                border: 1px solid #2d8cf0;
                &:hover{
                    color: #e9e9e9;
                }
            }

            &.@{namespaces}-cancel {
                background: transparent;
                border: none;
                &:hover{
                    color: #2d8cf0;
                }
            }
        }
    }



    // 图标
    .@{namespaces}-icon{
        margin-right: 4px;
        font-size: 16px;
        width: 16px;

        &.@{namespaces}-info{
            color: #2d8cf0;
        }
        &.@{namespaces}-error{
            color: #ed4014;
        }
        &.@{namespaces}-success {
            color: #19be6b;
        }
        &.@{namespaces}-warning {
            color: #ff9900;
        }
    }

    // 背景
    &.@{namespaces}-background{
        box-shadow: none !important;

        &.@{namespaces}-bg-info {
            background-color: #f0faff !important;
            color: #2d8cf0;
            border: 1px solid #d4eeff;
        }
        &.@{namespaces}-bg-error {
            background-color: #ffefe6 !important;
            color: #ed4014;
            border: 1px solid #ffcfb8;
        }
        &.@{namespaces}-bg-success {
            background-color: #edfff3 !important;
            color: #19be6b;
            border: 1px solid #bbf2cf;
        }
        &.@{namespaces}-bg-warning {
            background-color: #fff9e6 !important;
            color: #ff9900;
            border: 1px solid #ffe7a3;
        }
    }

    /************************ 位置 ********************/
    &.@{namespaces}-top-center{
        margin: 0 auto;
        animation-name: VtMsgTopEnter;
        transform: translateY(15px);
        &.@{namespaces}-fixed{
            position: fixed;
            left: 50%;
            transform: translateY(15px) translateX(-50%);
        }
        &.@{namespaces}-remove{
            animation-name: VtMsgTopOut;
        }
    }

    &.@{namespaces}-left-top{
        margin-top: 15px;
        margin-left: 0;
        margin-right: auto;
        animation-name: VtMsgLeftEnter;

        &.@{namespaces}-remove {
            animation-name: VtMsgLeftOut;
        }
        &.@{namespaces}-fixed{
            position: fixed;
            left: 15px;
        }
    }

    &.@{namespaces}-right-top{
        margin-right: 0;
        margin-top: 15px;
        margin-left: auto;
        animation-name: VtMsgRightEnter;

        &.@{namespaces}-fixed{
            position: fixed;
            right: 15px;
        }

        &.@{namespaces}-remove{
            animation-name: VtMsgRightOut;
        }
    }

    &.@{namespaces}-left-center{
        position: fixed;
        opacity: 1;
        left: 15px;
        top: 50%;
        transform: translate3d(0,-50%,0);
        animation-name: VtMsgLeftEnter;

        &.@{namespaces}-remove{
            animation-name: VtMsgLeftOut;
        }

    }

    &.@{namespaces}-center-center{
        position: fixed;
        animation-name: VtMsgOpacityEnter;
        left: 50%;
        top: 50%;
        transform: translate3d(-50%,-50%,0);

        &.@{namespaces}-remove{
            animation-name: VtMsgOpacityOut;
        }
    }

    &.@{namespaces}-right-center{
        position: fixed;
        opacity: 1;
        right: 15px;
        top: 50%;
        transform: translateY(-50%);
        animation-name: VtMsgRightEnter;
        &.@{namespaces}-remove{
            animation-name: VtMsgRightOut;
        }
    }

    &.@{namespaces}-left-bottom{
        position: fixed;
        top: auto;
        left: 15px;
        opacity: 1;
        bottom: 15px;
        animation-name: VtMsgBottomEnter;
        &.@{namespaces}-remove{
            animation-name: VtMsgBottomOut;
        }
    }


    &.@{namespaces}-bottom-center{
        position: fixed;
        top: auto;
        left: 50%;
        opacity: 1;
        bottom: 15px;
        transform: translateX(-50%);
        animation-name: VtMsgBottomEnter;
        &.@{namespaces}-remove{
            animation-name: VtMsgBottomOut;
        }
    }

    &.@{namespaces}-right-bottom{
        position: fixed;
        right: 15px;
        bottom: 15px;
        top: auto;
        opacity: 1;
        animation-name: VtMsgBottomEnter;

        &.@{namespaces}-remove{
            animation-name: VtMsgBottomOut;
        }
    }
}


@media screen and (max-width: 768px) {

    .@{namespaces}-message{
        max-width: calc(100% - 30px);
    }
}

/************************ 动画 ********************/

@keyframes VtMsgLeftEnter{
    0%{
        opacity: 0;
        margin-left: -100%;
    }
    100%{
        opacity: 1;
        margin-left: 0;
    }
}
@keyframes VtMsgLeftOut{
    0%{
        opacity: 1;
        margin-left: 0;
    }
    100%{
        opacity: 0;
        margin-left: -100%;
    }
}

@keyframes VtMsgRightEnter{
    0%{
        opacity: 0;
        margin-right: -100%;
    }
    100%{
        opacity: 1;
        margin-right: 0;
    }
}
@keyframes VtMsgRightOut{
    0%{
        opacity: 1;
        margin-right: 0;
    }
    100%{
        opacity: 0;
        margin-right: -100%;
    }
}

@keyframes VtMsgOpacityEnter {
    0%{
        opacity: 0;
    }
    100%{
        opacity: 1;
    }
}

@keyframes VtMsgOpacityOut {
    0%{
        opacity: 1;
    }
    100%{
        opacity: 0;
    }
}
@keyframes VtMsgBottomEnter {
    0%{
        opacity: 0;
        margin-bottom: -100%;
    }
    100%{
        opacity: 1;
        margin-bottom: 0;
    }
}
@keyframes VtMsgBottomOut {
    0%{
        opacity: 1;
        margin-bottom: 0;
    }
    100%{
        opacity: 0;
        margin-bottom: -100%;
    }
}

@keyframes VtMsgTopEnter {
    0%{
        margin-top: -100%;
        opacity: 0;
    }
    100%{
        margin-top: 0;
        opacity: 1;
    }
}
@keyframes VtMsgTopOut {
    0%{
        opacity: 1;
        margin-top: 0;
    }
    100%{
        opacity: 0;
        margin-top: -100%;
    }
}

